import GameConfig from "../config/GameConfig.js";
import Rect from "./Rect.js";
import RectType from "./RectType.js";
export default class MapRect extends Rect {
    constructor(x = 0, y = 0, width = GameConfig.RectSize, height = GameConfig.RectSize) {
        super(x, y, width, height);
        // f = g + h
        this.f = 0;
        this.g = 0;
        this.h = 0;
        this.type = RectType.Ground;
        this.parent = null;
    }
    draw(context) {
        if (!context)
            return;
        // context.fillStyle = this.type == RectType.Ground ? 'green' : '#f52'
        switch (this.type) {
            case RectType.Border:
                context.fillStyle = GameConfig.TileColor.Border;
                break;
            case RectType.Ground:
                context.fillStyle = GameConfig.TileColor.Ground;
                break;
            case RectType.Obstacles:
                context.fillStyle = GameConfig.TileColor.Obstacles;
                break;
        }
        context.fillRect(this.x * this.width + 1, this.y * this.height + 1, this.width - 1, this.height - 1);
        context.strokeStyle = '#999';
        context.font = '16px 宋体';
        context.strokeText(`(${this.x},${this.y})`, this.x * this.width + 2, this.y * this.height + 14);
    }
}
